package com.kgc.scd.controller;

import com.kgc.scd.service.WechatPayService;
import com.kgc.scd.util.RequestResult;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created On : 2022/6/20.
 * <p>
 * Author     : 98730
 * <p>
 * Description: WechatPayController
 */
@Slf4j
@Api(tags = "20、微信支付操作入口")
@RestController
public class WechatPayController {

    @Autowired
    private WechatPayService wechatPayService;

    @PostMapping("/unifiedOrderFeign")
    @ApiOperation(value = "生成微信支付接口",notes = "请求微信官方，统一下单，返回支付结果")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单号")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "SUCCESS"),
            @ApiResponse(code = 500, message = "FAIL")
    })
    public RequestResult<Map<String, String>> wechatPayUnifiedOrderFeign(@RequestParam String orderId) throws Exception {
        return wechatPayService.wechatPayUnifiedOrder(orderId);
    }




}
